﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class BasicBlocks
    {
        public static void WhileLoop1()
        {
            int sum = 0;
            for (int i = 0; i < 10; i++)
                sum += i;
            Console.WriteLine("sum {0}", sum);
        }

        public static void NestedWhileLoop()
        {
            int i = 0;
            int total = 0;
            while (i < 100)
            {
                int subtotal = 0;
                int j = i;
                while (j < i + 10)
                {
                    subtotal += j;
                    j++;
                }
                i++;
                total += subtotal;
            }
        }

        public static void IfStmt()
        {
            if (Console.ReadLine() == "first")
            {
                Console.WriteLine("first");
            }
            else
            {
                Console.WriteLine("second");
            }
        }

        public static void NestedIfStmt()
        {
            int x = Console.Read();
            int y = Console.Read();
            if (x != y)
            {
                int z = Console.Read();
                if (x == y || y == z)
                {
                    Console.WriteLine("magic");
                }
            }
        }

        public static void WhileAndIfStmt()
        {
            int i = 0;
            int j = 11;
            while (i-- == ++j)
            {
                if ((j - i) < 10)
                {
                    Console.WriteLine("yep");
                }
            }
        }

        public static void WhileAndBreak()
        {
            int i = 0;
            int j = 11;
            while (true)
            {
                if (((j --) - (++i)) < 10)
                {
                    break;
                }
            }
        }


    }

    class Program
    {
        static void Test(int x, string y)
        {
            Console.WriteLine("{0}{1}", x, y);

        }

        static void Main(string[] args)
        {
            //const int x = 999999;
            //const string y = "test";
            //Test(x, y);
            //Test(x, y);
            //var x1 = new System.Collections.Generic.List<int>();
            //x1.Select(y1 => y1 + 1).Where(y1 => y1 > 2).Sum();

            int sum = 0;
            for (int i = 0; i < 10; i++)
                sum += i;
            Console.WriteLine("sum {0}", sum);
        //    int x = 0;
        //    int y = 1;
        //    int z = x + y;
        //H:
        //    if (x == y)
        //    {
        //        goto H;
        //    }
            //Test(1, "2");
            //int x = 1;
            //int y = 2;
            //int z = x + y;
            //Console.WriteLine("{0} {1} {2}", x, y, z);
            //int x = 1;
            //int y = 2;
            //int z = 3;
            //if (x == y)
            //{
            //    z = 4;
            //}
            //Console.WriteLine("{0}", z);

        }
    }
}
